# find libsoup-2.4
# Once done this will define
# libsoup2_FOUND
# libsoup2_INCLUDE_DIRS - The libsoup-2.4 include directories
# libsoup2_LIBRARIES    - The libraries needed to use libsoup-2.4
# libsoup2_DEFINITIONS  - Compiler switches required for using libsoup-2.4

find_package(PkgConfig)
pkg_check_modules(PC QUIET libsoup-2.4)

#message(STATUS "LIBRARIES    : ${PC_LIBRARIES}")
#message(STATUS "LIBRARY DIRS : ${PC_LIBBRARY_DIRS}")
#message(STATUS "LDFLAGS      : ${PC_LDFLAGS}")
#message(STATUS "LDFLAGS OTHER: ${PC_LDFLAGS_OTHERS}")
#message(STATUS "INCLUDE DIRS : ${PC_INCLUDE_DIRS}")
#message(STATUS "CFLAGS       : ${PC_CFLAGS}")
#message(STATUS "CFLAGS OTHER : ${PC_CFLAGS_OTHER}")

set(libsoup2_DEFINITIONS ${PC_CFLAGS_OTHER})

find_path(libsoup2_INCLUDE_DIR  libsoup/soup.h
        HINTS ${PC_INCLUDE_DIRS}
	PATH_SUFFIXES libsoup-2.4)

find_library(libsoup2_LIBRARY NAMES soup-2.4
        HINTS ${PC_LIBRARY_DIRS} )

set(libsoup2_LIBRARIES ${libsoup2_LIBRARY} )
set(libsoup2_INCLUDE_DIRS ${libsoup2_INCLUDE_DIR} )

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set libsoup2_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(libsoup2 DEFAULT_MSG
	libsoup2_LIBRARY libsoup2_INCLUDE_DIR)

mark_as_advanced(libsoup2_INCLUDE_DIR libsoup2_LIBRARY )
